package edu.gyc.hiblog.controller;


import edu.gyc.hiblog.common.Result;
import edu.gyc.hiblog.model.HiBlog;
import edu.gyc.hiblog.model.HiUser;
import edu.gyc.hiblog.service.HiBlogService;
import edu.gyc.hiblog.service.HiUserService;
import edu.gyc.hiblog.util.ShiroUtil;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 关注公众号：MarkerHub
 * @since 2020-05-25
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    HiUserService userService;

    @RequiresAuthentication
    @GetMapping("/index")
    public Result index() {
        HiUser user = userService.getById(1L);
        return Result.success(user);
    }

    @PostMapping("/save")
    public Result save(@Validated @RequestBody HiUser user) {
        return Result.success(user);
    }

}
